package org.offsync

import java.nio.channels.ServerSocketChannel
import java.nio.channels.SocketChannel
import org.offsync.util.Window
import scala.collection.mutable.PriorityQueue

package object rich {
  implicit def enrichAs[T](value: T) = new RichAs(value)
  implicit def enrichByteWindow(value: Window[Byte]) = new RichByteWindow(value)
  implicit def enrichCloseable[T <: { def close(): Unit }](closeable: T) = RichCloseable[T](closeable)
  implicit def enrichInt(value: Int) = RichInt(value)
  implicit def enrichIterator[T](selector: java.util.Iterator[T]) = RichIterator[T](selector)
  implicit def enrichObject(value: Object) = RichObject(value)
  implicit def enrichPriorityQueue[T](priorityQueue: PriorityQueue[T]) = new RichPriorityQueue[T](priorityQueue)
  implicit def enrichString(value: String) = RichString(value)
  implicit def enrichSelector(selector: java.nio.channels.Selector) = RichSelector(selector)
  implicit def enrichSelectableChannel(channel: java.nio.channels.SelectableChannel) = new RichSelectableChannel(channel)
  implicit def enrichServerSocketChannel(serverSocketChannel: ServerSocketChannel) = RichServerSocketChannel(serverSocketChannel)
  implicit def enrichSocketChannel(socketChannel: SocketChannel) = new RichSocketChannel(socketChannel)
}
